<?php

/**
 * LoginForm class.
 * LoginForm is the data structure for keeping
 * user login form data. It is used by the 'login' action of 'SiteController'.
 */
class StatisticsFrom extends CFormModel
{
	public $time;

	/**
	 * Declares the validation rules.
	 * The rules state that username and password are required,
	 * and password needs to be authenticated.
	 */
	public function rules()
	{
		return array(
			
			array('time', 'required'),
			array('time', 'match','pattern' => '/\d{4}-\d{2}$/','message'=>'{attribute} 必须为日期型(年-月)'),
		);
	}
	
	protected function afterValidate($on){
		if($this->hasErrors()) return;
		$this->time.='-01';
	}

	/**
	 * Declares attribute labels.
	 */
	public function attributeLabels()
	{
		return array(
			'time'=>'统计时间',
		);
	}
}
